package cn.itsource.controller.app;


import cn.dev33.satoken.annotation.SaIgnore;
import cn.itsource.pojo.dto.WxMinAppLoginDTO;
import cn.itsource.pojo.vo.LoginVO;
import cn.itsource.result.JSONResult;
import cn.itsource.service.ILoginService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Tag(name = "登录表",description = "登录表")
@RestController
@RequestMapping("/app/login")
public class AppLoginController {

    @Autowired
    public ILoginService loginService;

    @Operation( summary= "通用小程序的微信登录",description = "通用小程序的微信登录")
    @Parameter(name = "login",description = "保存的对象",required = true)
    @PostMapping("/minapp")
    //@SaCheckLogin
    @SaIgnore
    public JSONResult wxMinAppLogin(@RequestBody @Valid WxMinAppLoginDTO dto){
        LoginVO loginVO = loginService.wxMinAppLogin(dto);
        return JSONResult.success(loginVO);
    }

}
